<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="s_search" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 选择供应商 </span>
      </div>
      <div>
      </div>
      <div class="el-select">
        <el-input v-model="s_search.client_name" placeholder='供应商名称' />
      </div>
      <el-button @click="getPage(1);" type='primary' size="mini"><i class='fa fa-search'></i>搜索</el-button>
      <el-table :data="pageList" v-loading="loading">
        <el-table-column label="选择" prop="client_id" width="80">
          <template slot-scope="scope">
            <el-button @click="$parent.$parent.closeProductBuySupplier(scope.row['client_id'],scope.row['client_name']);" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
          </template>
        </el-table-column>
        <el-table-column label="供应商" prop="client_name">
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ProductBuySupplier',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_search: {
          client_name: null,
        },
        s_client: [],
        loading: true,
        pageList: [],
        pageSize: 10,
        total: null,
        rules: {
          client_name: [{
            required: true,
            message: "不能为空",
            trigger: 'blur',
          }],
        }
      }
    },
    created() {
      this.getPage(1);
    },
    updated() {},
    mounted() {},
    methods: {
      getPage(page) {
        this.loading = true;
        this.s_search.pageNo = page.page || page;
        this.s_search.pageSize = page.limit || 10;
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/product/ProductSail/s_client?' + this.vueparams,
          params: this.s_search
        }).then(data => {
          this.loading = false;
          this.pageList = data.rows;
          this.total = data.total;
        })
      },
    },
  }
</script>
